
layui.define(['table', 'form','layer'], function(exports){
  var $ = layui.$
  ,table = layui.table
  ,form = layui.form;
  table.render({
    elem: '#org-table'
    ,url: 'org/getPageList' 
    ,cols: [[
      {type: 'checkbox', fixed: 'left'}
      ,{field: 'id', width: 100, title: 'ID',hide:true}
      ,{field: 'parentId', width: 100, title: '父ID',hide:true}
      ,{field: 'code', title: '机构编号', width:100}
      ,{field: 'name', title: '机构名称', width:200}
      ,{field: 'shortName', title: '机构简称', width: 170}
      ,{field: 'orgTypeTxt', title: '机构类型', width: 140}
      ,{field: 'staffNum', title: '人员数量', width: 140}
      ,{field: 'managerName', title: '部门经理', width: 140}
      ,{field: 'superintendentName', title: '部门主管', width: 140}
      ,{field: 'orderno', title: '排序',edit:'text', width: 100}
    ]]
    ,page: true
    ,limit: 30
    ,height: top.height - 100
    ,text: '对不起，加载出现异常！'
    ,done:function(){
        enableRowClick(table,form,'org-table',"org-table");
    }	
  });
  table.on("edit(org-table)",function(obj){
	 $.ajax({
		 url:'org/modify',
		 type:'POST',
		 data:obj.data,
		 dataType:'json',
		 success:function(ret){
			 layer.msg("保存成功",{icon:1});
			 refreshNode();
			 table.reload('navi-table'); 
		 }
	 })
  })


  exports('org', {})
});